function [total_ll] = aggregate_beliefs(states,xadata,fixedparms,spec,w,alpha) 
% This function loops over all combinations of good girl and likeschool,
% calculates the log likelihood separately for each combination and then
% sums them together. 

total_ll=0;
   for g=[0 1]
        for l=[0 1]
            
            % set up temp structure 
            tempxadata.G_exante=xadata.G_exante(xadata.good_girl==g & xadata.like_school==l,:);
            tempxadata.age=xadata.age(xadata.good_girl==g & xadata.like_school==l,:);
            tempxadata.ed=xadata.ed(xadata.good_girl==g & xadata.like_school==l,:);
            tempxadata.stillinschool=xadata.stillinschool(xadata.good_girl==g & xadata.like_school==l,:);
            tempxadata.chosen_marry=xadata.chosen_marry(xadata.good_girl==g & xadata.like_school==l,:);
            tempxadata.chosen_school=xadata.chosen_school(xadata.good_girl==g & xadata.like_school==l,:);
            tempxadata.good_girl=xadata.good_girl(xadata.good_girl==g & xadata.like_school==l,:);
            tempxadata.like_school=xadata.like_school(xadata.good_girl==g & xadata.like_school==l,:);
            tempxadata.w=w(xadata.good_girl==g & xadata.like_school==l,:);

            fixedparms.ind_goodgirl=g;
            fixedparms.ind_likeschool=l;

            likelikhood_cont=ex_ante_mom(states,tempxadata,fixedparms,spec,alpha) ;
            
            total_ll=total_ll+likelikhood_cont;
   
        end
    end

end